package com.atguigu.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.sql.DataSource;

//如果我们只是需要返回数据 不需要页面 就用这个注解
@RestController
public class HelloController2 {
//    @Autowired
//    private DataSourceProperties dataSourceProperties;
//    @Autowired
//    private DataSourceProperties2 dataSourceProperties2;

    @Autowired
    private DataSource dataSource;

    @Autowired
    private RedisTemplate redisTemplate;

    @RequestMapping("/hello")
    public String hello(){
//        redisTemplate.opsForValue().set("zhangsan","100");
//        System.out.println("项目第一次启动");
        System.out.println("自定义starter里面的数据源"+dataSource+"::"+dataSource.getClass());
        //String代表的是一个页面路径
        return "springboot is running2";
    }
}
